import { createRouter, createWebHistory } from 'vue-router'
import Login from '../components/Login.vue'
import Layout from '../components/Layout.vue'
import UserList from '../components/user/UserList.vue'
import UserAdd from '../components/user/UserAdd.vue'
import UserEdit from '../components/user/UserEdit.vue'
import RoleList from '../components/role/RoleList.vue'
import RoleAdd from '../components/role/RoleAdd.vue'
import RoleEdit from '../components/role/RoleEdit.vue'
import ResourcesList from '../components/resources/ResourcesList.vue'
import ResourcesAdd from '../components/resources/ResourcesAdd.vue'
import ResourcesEdit from '../components/resources/ResourcesEdit.vue'
import UpdatePassword from '../components/UpdatePassword.vue'


const routes = [
  { path: '/login', component: Login },
  {
    path: '/',component: Layout,
    children: [
      { path: 'users', component: UserList },
      { path: 'users/add', component: UserAdd },
      { path: 'users/edit/:id', component: UserEdit },
      { path: 'roles', component: RoleList },
      { path: 'roles/add', component: RoleAdd },
      { path: 'roles/edit/:id', component: RoleEdit },
      { path: 'resources', component: ResourcesList },
      { path: 'resources/add/:id', component: ResourcesAdd },
      { path: 'resources/edit/:id', component: ResourcesEdit },
      { path: 'update-password', component: UpdatePassword }

    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router